package cn.dengta.webapp.user.model;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;

import com.alibaba.fastjson.annotation.JSONType;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.EasyDate;

@Getter
@Setter
@JSONType(ignores = { "beginTime", "endTime" })
public class UserVipRule implements Serializable {

	/** 解锁VIP专属礼物；0=否；1=是 */
	private Integer vipGift;
	/** 每天赠送钻石 */
	private Integer coinDay;
	/** VIP标识；0=否；1=是 */
	private Integer vipTag;
	/** VIP推荐；0=否；1=是 */
	private Integer vipRecommend;
	/** 语音卡 xx/月 */
	private Integer audioMinute;
	/** 语音卡 有效期天数 */
	private Integer audioDayLife;
	/** 每次充值额外赠送钻石数量 */
	private Integer coinNum;
	/** 视频卡 xx/月 */
	private Integer videoMinute;
	/** 视频卡 有效期天数 */
	private Integer videoDayLife;
	/** 精选曝光；0=否；1=是 */
	private Integer exposure;
	/** 等级 1=VIP; */
	private Integer level;
	/** 天数 */
	private Integer days;

	/**
	 * 获取结束时间
	 */
	public Date getEndTime() {
		return getEndTimeFormat(new Date());
	}

	public Date getEndTime(Date date) {
		return getEndTimeFormat(date);
	}

	private Date getEndTimeFormat(Date da) {
		EasyDate date = new EasyDate(da);
		date.addDay(this.days);
		return date.endOf(Calendar.DAY_OF_MONTH).toDate();
	}

	public static final String VIP_GIFT = "vipGift";
	public static final String COIN_DAY = "coinDay";
	public static final String VIP_TAG = "vipTag";
	public static final String VIP_RECOMMEND = "vipRecommend";
	public static final String AUDIO_MINUTE = "audioMinute";
	public static final String COIN_NUM = "coinNum";
	public static final String VIDEO_MINUTE = "videoMinute";
	public static final String EXPOSURE = "exposure";

}
